<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>继承</title>
</head>
<body>
<script>
    function Animal(age) {
        this.age = age;
    }
    Animal.prototype.eat = function () {
        console.log('动物吃东西')
    };
    function Dog(name,age) {
        Animal.call(this, age);
        this.name = name;
    }
    // 继承父类属性方法
    Dog.prototype = Object.create(Animal.prototype);
    Dog.prototype.constructor = Dog;
    // 增强子类
    Dog.prototype.bark = function () {
        console.log(this.name + '叫！！！！！！')
    };
</script>
</body>
</html>
